import { Notification } from '@arco-design/web-vue'

interface NotificationOptions {
  title?: string
  content?: string
  duration?: number
}

export function useNotification() {
  // 定义默认标题映射
  const defaultTitles = {
    success: '成功',
    error: '错误',
    warning: '警告',
    info: '提示',
  }

  const success = (message: string, options?: NotificationOptions) => {
    Notification.success({
      title: options?.title || defaultTitles.success,
      content: options?.content || message,
      duration: options?.duration || 3000,
    })
  }

  const error = (message: string, options?: NotificationOptions) => {
    Notification.error({
      title: options?.title || defaultTitles.error,
      content: options?.content || message,
      duration: options?.duration || 3000,
    })
  }

  const warning = (message: string, options?: NotificationOptions) => {
    Notification.warning({
      title: options?.title || defaultTitles.warning,
      content: options?.content || message,
      duration: options?.duration || 3000,
    })
  }

  const info = (message: string, options?: NotificationOptions) => {
    Notification.info({
      title: options?.title || defaultTitles.info,
      content: options?.content || message,
      duration: options?.duration || 3000,
    })
  }

  return {
    success,
    error,
    warning,
    info,
  }
}
